package com.jungle.mvvm.sample.util;

import android.content.Context;
import android.os.Environment;

import com.jungle.mvvm.utils.FileUtil;

/**
 * @ClassName PathUtil
 * @Description PathUtil
 * @Author Daniel
 * @Version V1.0.0
 */
public class PathUtil {

    private PathUtil() {
        throw new UnsupportedOperationException("u can't instantiate me...");
    }


    //应用安装路径
    public static String filePath = "";
    //apk存放路径
    public static String apkPath = "";
    //照片路径
    public static String imagePath = "";
    //视频路径
    public static String video = "";
    //存放压缩照片的目录路径
    public static String tinyPath = "";
    //其他文件目录路径
    public static String otherPath = "";
    //错误日志的目录路径
    public static String errorPath = "";

    /**
     * 创建路径
     *
     * @param mContext 上下文
     */
    public static void createPath(Context mContext) {
        // 判断的、能否获取sd卡
        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
            filePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + mContext.getPackageName() + "/download";
            apkPath = filePath + "/apk/";
            imagePath = filePath + "/image/";
            video = filePath + "/appImage/";
            tinyPath = filePath + "/tiny/";
            otherPath = filePath + "/other/";
            errorPath = filePath + "/error/";
            FileUtil.createOrExistsDir(apkPath);
            FileUtil.createOrExistsDir(imagePath);
            FileUtil.createOrExistsDir(video);
            FileUtil.createOrExistsDir(tinyPath);
            FileUtil.createOrExistsDir(otherPath);
            FileUtil.createOrExistsDir(errorPath);
        }
    }
}
